<?php
//登录
    header("Access-Control-Allow-Origin: *"); // 允许跨域的地址，* 表示全部
    header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS"); // 允许的请求方法
    header("Access-Control-Allow-Headers: version, access-token, user-token"); // 允许的请求头属性

    include_once '../util/connect.php';

    $Phone = $_POST['Phone'];
    $Pwd = $_POST['Password'];
    $Pwd1 = $Pwd.'0xz765nb';
    
    //加密后密码,加盐0xz765nb
    $Password =md5($Pwd1);
   
    $sql = "select * from user where Phone='$Phone' and Password='$Password' and Status = '0' ";
    $data = my_Select($sql);

    if(count($data) > 0 ){
        $arr = [
            "status" => 0,
            "message" => "登陆成功"
        ];
        if (!session_id()) session_start();
        $_SESSION['userInfo'] = $data[0];
    }else{
        $arr = [
            "status" => 1,
            "message" => "登陆失败"
        ];
    }
    

    

    echo json_encode($arr,JSON_UNESCAPED_UNICODE);
 